import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)

const routes = [
  //登陆
 {
    path:'/login',
    component: ()=>import('@/views/login.vue')
  },
  //注册
   {
    path:'/register',
    component: ()=>import('@/views/register.vue')
  },
  //重定向
     {
        path:'/',
        redirect:'/register'
      },
      //
      // 默认跳转页面
  {
    path:'*',
      component: ()=>import('@/views/login.vue')
  },
 
  // 为了避免嵌套太多,只能拿出来
  
  //首页 -- 查找租客
  {
    path:'/find',
    component:()=>import('@/home/find/home-find.vue'),
  },
//  首页 头像
  {    path:'/personal',
    component:()=>import('@/home/personal-center/personal.vue')
  },
  // 首页  租客详情
   {    path:'/particulars',
    component:()=>import('@/home/find/particulars.vue')
  },
  //首页  中意租客
  {    path:'/particulars',
    component:()=>import('@/home/find/particulars.vue')
  },
  // 首页  租客详情
{    path:'/details',
     name:'Details',
    component:()=>import('@/home/find/details.vue')
  },
  //我的  页面
  {
    path:'/wallet',
    component:()=>import('@/my/my-wallet.vue')
  },
  {
    path:'/about',
    component:()=>import('@/my/my-about.vue')
  },
   {
    path:'/buy',
    component:()=>import('@/my/my-buy.vue')
  },
     {
    path:'/over',
    component:()=>import('@/my/my-over.vue')
  },
  {
    path:'/opinion',
    component:()=>import('@/my/my-opinion.vue')
  },

  // 消息
{
path:'/td-message',
component:()=>import('@/message/td-message.vue'),
},
{
  path:'/tt-message',
  name:'mess',
  component:()=>import('@/message/tt-message.vue'),
   },
  {
 path:'/th-resource',
 component:()=>import('@/resource/th-resource.vue'),
},
  // 父组件
  {
    path:'/home',
    component:()=> import('@/views/fly-home.vue'),
  // 子组件
  
  // 首页
    children: [
      {
        path:'sonHome',
        component:()=>import('@/pages/sonHome.vue'),
      },
      //消息
       {
        path:'sonMessage',
        component:()=>import('@/pages/sonMessage.vue'),
   
      
      },
      // 我的
       {
        path:'sonMy',
        component:()=>import('@/pages/sonMy.vue'),
      },
      // 房源管理
       {
        path:'sonResource',
        component:()=>import('@/pages/sonResource.vue'),
        // 这是房源管理的子组件
        children:[
          {
            path:'tt-resource',
            name:'tt',
              component:()=>import('@/resource/tt-resource.vue'),
          },
           {
            path:'td-resource',
              component:()=>import('@/resource/td-resource.vue'),
          },
          ,
       
           {
        path:'/',
        redirect:'/home/sonResource/tt-resource'
      },
        ]
      },
      
    ]
  },
  
]

const router = new VueRouter({
  routes
})

export default router
